﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;
using System.Data.SqlClient;
public partial class BaseData_ProductColumnSP : System.Web.UI.Page
{
    protected void Page_PreInit(object sender, EventArgs e)
    {
        Page.Theme = BLL.Common.GetWSMThemes();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        Button1.Attributes.Add("onclick", "return jsf();");
        if (!IsPostBack)
        {
            if (Request.QueryString["code"] != null)
            {
                DataBind(Request.QueryString["code"].ToString());
            }
        }
    }
    private void DataBind(string code)
    {
        DataSet ds = new BLL.SHANGPIN().GetSPCOMMODITY_TYPE_SHANGPINList(Int32.Parse(code.Trim()));
        Select1.DataSource = ds.Tables[0].DefaultView;
        Select1.DataTextField = "spmc";
        Select1.DataValueField = "spdm";
        Select1.DataBind();
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        //if (Hidden1.Value.Trim().Length > 1)
        //{
            string spdmstr = Hidden1.Value.Trim();

                if (Request.QueryString["code"].ToString().Trim() != "")
                {
                    if (!Check.CheckPermission("200300103", "00002"))
                    {
                        Share.Alert(Page, "无权操作"); return;
                    }
                    int val = new BLL.SHANGPIN().GetSPCOMMODITY_TYPE_SHANGPIN_Update(Int32.Parse(Request.QueryString["code"].ToString().Trim()), spdmstr);
                    if (val == 1)
                    {
                        Share.InsertLog("200300103", "00002");
                    }
                    else
                    {
                        Share.Alert(Page, "操作失败"); return;
                    }
                }
                Response.Redirect("ProductColumnSP.aspx?code=" + Request.QueryString["code"].ToString().Trim());
        //}
        //else
        //{
        //    Share.Alert(Page, "请选择商品"); return;
        //}
    }
}
